/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pgentity;

import config.PGConfig;
import db.PGKeys;
import db.RedisKey;
import java.util.concurrent.TimeUnit;
import pgentity.redis.hash.ExpiredDataHash;

/**
 *
 * @author Salm
 */
public class SaleoffData extends ExpiredDataHash {
    
    private SaleoffData(String saleToken, String uid) {
        super(key(uid, saleToken),
                PGConfig.inst().temp().SaleOffKeyExpireInDay, TimeUnit.DAYS);
    }
    
    public static SaleoffData getData(String saleToken, String uid)
    {
        return new SaleoffData(saleToken, uid);
    }
    
    private static RedisKey key(String token, String uid)
    {
        return PGKeys.USERS.getChild(uid).getChild(PGKeys.FD_SALEOFF)
                .getChild(token);
    }
}
